package com.mobilebsc.httpclient.callback;

import org.apache.http.HttpEntity;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

public class MbscRestClient {
	  private static final String BASE_URL = "http://mco.tgas.at/MobileBSC/MobileBSC.svc/";
	  private static AsyncHttpClient client = new AsyncHttpClient();;  
	  
	  public static void get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
		  client.addHeader("Accept", "application/json");
		  client.get(getAbsoluteUrl(url), params, responseHandler);
	  }

	  public static void post(String url, RequestParams params, HttpEntity entity, AsyncHttpResponseHandler responseHandler) {
		  client.post(null, getAbsoluteUrl(url), entity, "application/json", responseHandler);
	  }

	  private static String getAbsoluteUrl(String relativeUrl) {
	      return BASE_URL + relativeUrl;
	  }
}